package com.kukudexin.AdvanceThread;

import java.util.concurrent.locks.LockSupport;

/**
 * @author: 酷酷的鑫
 * @Date: 13:40
 * @description:
 */
public class LockSupportThread {

    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + ",1");
                // 阻塞当前线程
                LockSupport.park();
                System.out.println(Thread.currentThread().getName() + ",2");
            }
        },"t1");
        t1.start();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        LockSupport.unpark(t1);
    }
}
